import sys
from dingtalkchatbot.chatbot import DingtalkChatbot
from dingtalkchatbot.chatbot import CardItem
from dingtalkchatbot.chatbot import ActionCard
# WebHook地址
#webhook = 'https://oapi.dingtalk.com/robot/send?access_token=02fd5264b64d3907ec768ad1b133f739cb5720e7e90148d4e6ca37cf34a83a94'
#xiaoding = DingtalkChatbot(webhook) 

# ActionCard独立跳转消息类型
# macdown   支持@对应人+跳转所以选择macdown发送
change = sys.argv[1]
theme = sys.argv[2]
project = sys.argv[3]
servername = sys.argv[4]
bindip = sys.argv[5]
severity = sys.argv[6]
value = sys.argv[7]
activetime = sys.argv[8]
webhook = sys.argv[9]
Mobiles = sys.argv[10]
xiaoding = DingtalkChatbot(webhook)

#at_mobiles=[Mobiles]
xiaoding.send_markdown(title='wethink', text=change+'\n'
                    '> 主题:'+theme+'\n\n'
                    '> 项目:'+project+'\n\n'
                    '> 服务名:'+servername+'\n\n'
                    '> ip:'+bindip+'\n\n'
                    '> 等级:'+severity+'\n\n'
                    '> 值:'+value+'\n\n'
                    '> 时间:'+activetime+'\n', 
                    )






